package com.rstrulak.dao;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.rstrulak.core.dao.GenericDaoImpl;
import com.rstrulak.model.Note;
import com.rstrulak.model.User;

@Repository("noteDao")
public class NoteDaoImpl extends GenericDaoImpl<Note, Long> implements NoteDao {

	@Override
	public List<Note> getNoteListByUser(User user) {
		DetachedCriteria criteria = createDetachedCriteria();
		criteria.add(Restrictions.eq("owner", user));
		criteria.add(Restrictions.eq("isFinished", Boolean.FALSE));
		return getListByCriteria(criteria);
	}
}
